/**
 * 
 */
package com.zznode.redsun.smartcrm.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import com.zznode.csp.domain.basemodel.AssignedIdentifier;
import com.zznode.csp.domain.basemodel.CodeNameable;
import com.zznode.csp.domain.basemodel.UnDeletable;

/**
 * 月收入
 * 
 * @author taoping
 * 
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "c_monthly_income")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class MonthlyIncome extends AssignedIdentifier implements CodeNameable<String>, UnDeletable {

	private static final long serialVersionUID = 1L;

	@Column(name = "code")
	protected String code;

	@Column(name = "name")
	protected String name;

	/**
	 * 描述
	 */
	@Column(name = "descrption")
	protected String descrption;

	/**
	 * 优先级
	 */
	@Column(name = "priority")
	protected Integer priority;

	/**
	 * 删除标记
	 */
	@Column(name = "is_deleted")
	protected Boolean isDeleted = Boolean.FALSE;

	public String getDescrption() {
		return descrption;
	}

	public void setDescrption(String descrption) {
		this.descrption = descrption;
	}

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public Boolean getIsDeleted() {
		return isDeleted;
	}

	public void setIsDeleted(Boolean isDeleted) {
		this.isDeleted = isDeleted;
	}

	@Override
	public boolean isDeleted() {
		return null == this.isDeleted ? false : this.isDeleted.booleanValue();
	}

	@Override
	public void markedAsAvailable() {
		this.isDeleted = Boolean.FALSE;
	}

	@Override
	public void markedAsDeleted() {
		this.isDeleted = Boolean.TRUE;
	}

	@Override
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Override
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return new StringBuilder("id : " + id).append("\tcode : " + code).append("\tname : " + name)
				.append("\tpriority : " + priority).append("\tisDeleted : " + isDeleted).toString();
	}

}
